From 3e14e8770576f253ca6ec090c0f3030d6f733b67 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 19 May 2006 23:03:09 +0000 Subject: [PATCH] Add write-only support for Franson Software's GPS Simulator format. --- Makefile.in | 2 +- defs.h | 5 + internal_styles.c | 70 +++++------ nmea.c | 2 +- reference/track/tracks.gpssim | 128 +++++++++++++++++++++ reference/waypoints.gpssim | 9 ++ testo | 9 ++ vecs.c | 7 ++ xmldoc/formats/gpssim.xml | 9 ++ xmldoc/formats/options/gpssim-split.xml | 17 +++ xmldoc/formats/options/gpssim-wayptspd.xml | 3 + 11 files changed, 224 insertions(+), 37 deletions(-) create mode 100644 reference/track/tracks.gpssim create mode 100644 reference/waypoints.gpssim create mode 100644 xmldoc/formats/gpssim.xml create mode 100644 xmldoc/formats/options/gpssim-split.xml create mode 100644 xmldoc/formats/options/gpssim-wayptspd.xml diff --git a/Makefile.in b/Makefile.in index 2f5287cda..c306f91df 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,7 +44,7 @@ FMTS=magproto.o gpx.o geo.o mapsend.o mapsource.o garmin_tables.o \ vcf.o overlay.o kml.o google.o lowranceusr.o an1.o tomtom.o \ tef_xml.o maggeo.o pathaway.o vitosmt.o gdb.o bcr.o coto.o \ ignrando.o stmwpp.o msroute.o cst.o nmn4.o mag_pdb.o compegps.o \ - yahoo.o unicsv.o wfff_xml.o garmin_txt.o axim_gpb.o + yahoo.o unicsv.o wfff_xml.o garmin_txt.o axim_gpb.o gpssim.o FILTERS=position.o duplicate.o arcdist.o polygon.o smplrout.o \ reverse_route.o sort.o stackfilter.o trackfilter.o discard.o \ diff --git a/defs.h b/defs.h index 4ebcb4fb1..f28206e2d 100644 --- a/defs.h +++ b/defs.h @@ -764,6 +764,11 @@ double fmt_speed(const double, char **tag); */ void gb_sleep(unsigned long microseconds); +/* + * From nmea.c + */ +int nmea_cksum(const char *const buf); + /* * Color helpers. */ diff --git a/internal_styles.c b/internal_styles.c index 69dc534b0..807024c57 100644 --- a/internal_styles.c +++ b/internal_styles.c @@ -853,40 +853,6 @@ static char tabsep[] = "IFIELD GEOCACHE_PLACER,\"\",\"%s\"\n" "IFIELD YYYYMMDD_TIME,\"\",\"%ld\"\n" ; -static char xmap[] = -"# gpsbabel XCSV style file\n" -"#\n" -"# Format: DeLorme Xmap Conduit\n" -"# Author: Alex Mottram\n" -"# Date: 12/09/2002\n" -"#\n" -"# \n" -"# As defined in csv.c/xmap\n" -"#\n" - -"DESCRIPTION DeLorme XMap HH Native .WPT\n" -"EXTENSION wpt\n" - -"#\n" -"# FILE LAYOUT DEFINITIIONS:\n" -"#\n" -"FIELD_DELIMITER COMMASPACE\n" -"RECORD_DELIMITER NEWLINE\n" -"BADCHARS COMMA\n" - -"PROLOGUE BEGIN SYMBOL\n" -"EPILOGUE END\n" -"#\n" -"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n" -"#\n" -"IFIELD LAT_HUMAN_READABLE, \"\", \"%08.5f\"\n" -"IFIELD LON_HUMAN_READABLE, \"\", \"%08.5f\"\n" -"IFIELD DESCRIPTION, \"\", \"%s\"\n" - -"OFIELD LAT_DECIMAL, \"\", \"%08.5f\"\n" -"OFIELD LON_DECIMAL, \"\", \"%08.5f\"\n" -"OFIELD DESCRIPTION, \"\", \"%s\"\n" -; static char xmap2006[] = "# gpsbabel XCSV style file\n" "#\n" @@ -925,6 +891,40 @@ static char xmap2006[] = +; +static char xmap[] = +"# gpsbabel XCSV style file\n" +"#\n" +"# Format: DeLorme Xmap Conduit\n" +"# Author: Alex Mottram\n" +"# Date: 12/09/2002\n" +"#\n" +"# \n" +"# As defined in csv.c/xmap\n" +"#\n" + +"DESCRIPTION DeLorme XMap HH Native .WPT\n" +"EXTENSION wpt\n" + +"#\n" +"# FILE LAYOUT DEFINITIIONS:\n" +"#\n" +"FIELD_DELIMITER COMMASPACE\n" +"RECORD_DELIMITER NEWLINE\n" +"BADCHARS COMMA\n" + +"PROLOGUE BEGIN SYMBOL\n" +"EPILOGUE END\n" +"#\n" +"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n" +"#\n" +"IFIELD LAT_HUMAN_READABLE, \"\", \"%08.5f\"\n" +"IFIELD LON_HUMAN_READABLE, \"\", \"%08.5f\"\n" +"IFIELD DESCRIPTION, \"\", \"%s\"\n" + +"OFIELD LAT_DECIMAL, \"\", \"%08.5f\"\n" +"OFIELD LON_DECIMAL, \"\", \"%08.5f\"\n" +"OFIELD DESCRIPTION, \"\", \"%s\"\n" ; static char xmapwpt[] = "# gpsbabel XCSV style file\n" @@ -958,7 +958,7 @@ static char xmapwpt[] = "IFIELD IGNORE, \"\", \"%-.31s\"\n" "IFIELD DESCRIPTION, \"\", \"%-.78s\"\n" ; -style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap2006", xmap2006 } , { "xmap", xmap } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "kwf2", kwf2 } , { "ktf2", ktf2 } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } , {0,0}}; +style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap", xmap } , { "xmap2006", xmap2006 } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "kwf2", kwf2 } , { "ktf2", ktf2 } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } , {0,0}}; size_t nstyles = 25; #else /* CSVFMTS_ENABLED */ style_vecs_t style_list[] = {{0,0}}; diff --git a/nmea.c b/nmea.c index af12da46a..b8cab9e5a 100644 --- a/nmea.c +++ b/nmea.c @@ -182,7 +182,7 @@ arglist_t nmea_args[] = { /* * Slightly different than the Magellan checksum fn. */ -static int +int nmea_cksum(const char *const buf) { int x = 0 ; diff --git a/reference/track/tracks.gpssim b/reference/track/tracks.gpssim new file mode 100644 index 000000000..1c8d2a878 --- /dev/null +++ b/reference/track/tracks.gpssim @@ -0,0 +1,128 @@ +$FRSPD,0.04*65 +$FRWPT,3003.73100,N,09136.62100,W,1.0,250502,170621*63 +$FRSPD,1.24*66 +$FRWPT,3003.76700,N,09136.63400,W,0.0,250502,170955*69 +$FRSPD,6.70*60 +$FRWPT,3003.76200,N,09136.49600,W,0.0,250502,171200*6C +$FRSPD,7.43*61 +$FRWPT,3003.74000,N,09136.44300,W,0.0,250502,171248*68 +$FRSPD,7.39*6C +$FRWPT,3003.69200,N,09136.31700,W,0.0,250502,171441*6F +$FRSPD,14.61*53 +$FRWPT,3003.58700,N,09135.96400,W,0.0,250502,171716*64 +$FRSPD,43.13*54 +$FRWPT,3003.46800,N,09135.80100,W,0.0,250502,171746*63 +$FRSPD,35.48*5B +$FRWPT,3003.32300,N,09135.69400,W,0.0,250502,171820*66 +$FRSPD,25.45*57 +$FRWPT,3003.23300,N,09135.55700,W,0.0,250502,171901*68 +$FRSPD,19.37*5D +$FRWPT,3002.98400,N,09135.38500,W,0.0,250502,172046*6E +$FRSPD,12.72*57 +$FRWPT,3002.94100,N,09135.39300,W,0.0,250502,172110*62 +$FRSPD,27.18*5D +$FRWPT,3002.92800,N,09135.57600,W,0.0,250502,172151*65 +$FRSPD,38.06*5C +$FRWPT,3002.77400,N,09135.78700,W,0.0,250502,172235*6F +$FRSPD,26.63*50 +$FRWPT,3002.73100,N,09135.92300,W,0.0,250502,172308*61 +$FRSPD,0.38*6A +$FRWPT,3002.83800,N,09136.01600,W,0.0,250502,180423*68 +$FRSPD,2.60*65 +$FRWPT,3002.82000,N,09135.97800,W,2.0,250502,180604*66 +$FRSPD,3.97*6C +$FRWPT,3002.78600,N,09135.96800,W,0.0,250502,180706*65 +$FRSPD,2.95*6F +$FRWPT,3002.77200,N,09135.93700,W,1.0,250502,180818*65 +$FRSPD,3.68*6C +$FRWPT,3002.78200,N,09135.86400,W,0.0,250502,181020*6E +$FRSPD,4.21*66 +$FRWPT,3002.78100,N,09135.83000,W,0.0,250502,181109*66 +$FRSPD,5.13*66 +$FRWPT,3002.80700,N,09135.78000,W,0.0,250502,181218*60 +$FRSPD,4.02*67 +$FRWPT,3002.84700,N,09135.71200,W,0.0,250502,181422*60 +$FRSPD,5.14*61 +$FRWPT,3002.86800,N,09135.68600,W,2.0,250502,181504*66 +$FRSPD,4.47*66 +$FRWPT,3002.89500,N,09135.64500,W,1.0,250502,181614*6A +$FRSPD,4.46*67 +$FRWPT,3002.92100,N,09135.62800,W,1.0,250502,181701*6A +$FRSPD,4.26*61 +$FRWPT,3002.96100,N,09135.63100,W,0.0,250502,181807*6E +$FRSPD,3.94*6F +$FRWPT,3003.01900,N,09135.63900,W,2.0,250502,181951*61 +$FRSPD,4.21*66 +$FRWPT,3003.04700,N,09135.64700,W,0.0,250502,182039*65 +$FRSPD,4.67*64 +$FRWPT,3003.07400,N,09135.66200,W,0.0,250502,182124*6F +$FRSPD,4.50*60 +$FRWPT,3003.10800,N,09135.66200,W,0.0,250502,182217*66 +$FRSPD,3.39*68 +$FRWPT,3003.13300,N,09135.68000,W,0.0,250502,182318*6C +$FRSPD,4.26*61 +$FRWPT,3003.18100,N,09135.68100,W,0.0,250502,182437*6E +$FRSPD,3.71*64 +$FRWPT,3003.29200,N,09135.71200,W,6.0,250502,182813*68 +$FRSPD,2.40*67 +$FRWPT,3003.22400,N,09135.69600,W,2.0,250502,183136*63 +$FRSPD,2.97*6D +$FRWPT,3003.19100,N,09135.68700,W,0.0,250502,183256*69 +$FRSPD,3.52*65 +$FRWPT,3003.15800,N,09135.69000,W,0.0,250502,183402*6D +$FRSPD,1.91*68 +$FRWPT,3003.14700,N,09135.72600,W,0.0,250502,183603*6C +$FRSPD,4.33*65 +$FRWPT,3003.14900,N,09135.75800,W,0.0,250502,183648*64 +$FRSPD,4.77*65 +$FRWPT,3003.15900,N,09135.80700,W,1.0,250502,183752*6B +$FRSPD,5.10*65 +$FRWPT,3003.18800,N,09135.87100,W,0.0,250502,183918*67 +$FRSPD,3.64*60 +$FRWPT,3003.21700,N,09135.87800,W,0.0,250502,184015*68 +$FRSPD,2.35*65 +$FRWPT,3003.23800,N,09135.86600,W,6.0,250502,184125*6E +$FRSPD,2.60*65 +$FRWPT,3003.21700,N,09135.88500,W,0.0,250502,184237*68 +$FRSPD,2.21*60 +$FRWPT,3003.19200,N,09135.87500,W,0.0,250502,184401*6A +$FRSPD,1.94*6D +$FRWPT,3003.16900,N,09135.85100,W,0.0,250502,184553*6E +$FRSPD,3.89*63 +$FRWPT,3003.15400,N,09135.81600,W,0.0,250502,184654*67 +$FRSPD,4.31*67 +$FRWPT,3003.14000,N,09135.78600,W,0.0,250502,184742*62 +$FRSPD,4.67*64 +$FRWPT,3003.13500,N,09135.74100,W,0.0,250502,184841*67 +$FRSPD,3.42*64 +$FRWPT,3003.13300,N,09135.70100,W,0.0,250502,184952*66 +$FRSPD,3.18*6B +$FRWPT,3003.11300,N,09135.68200,W,0.0,250502,185049*6C +$FRSPD,4.32*64 +$FRWPT,3003.06300,N,09135.66400,W,0.0,250502,185214*68 +$FRSPD,5.05*61 +$FRWPT,3003.03400,N,09135.65400,W,0.0,250502,185256*6F +$FRSPD,4.01*64 +$FRWPT,3003.01100,N,09135.64600,W,0.0,250502,185338*62 +$FRSPD,5.12*67 +$FRWPT,3002.94600,N,09135.62300,W,0.0,250502,185511*66 +$FRSPD,4.14*60 +$FRWPT,3002.90700,N,09135.65500,W,0.0,250502,185632*60 +$FRSPD,4.59*69 +$FRWPT,3002.88500,N,09135.68500,W,0.0,250502,185724*60 +$FRSPD,4.66*65 +$FRWPT,3002.85000,N,09135.72700,W,7.0,250502,185840*6B +$FRSPD,5.64*66 +$FRWPT,3002.82400,N,09135.76000,W,0.0,250502,185928*63 +$FRSPD,5.27*61 +$FRWPT,3002.79800,N,09135.79600,W,0.0,250502,190022*65 +$FRSPD,5.00*64 +$FRWPT,3002.78400,N,09135.85900,W,0.0,250502,190141*60 +$FRSPD,4.56*66 +$FRWPT,3002.77400,N,09135.90800,W,0.0,250502,190248*60 +$FRSPD,3.37*66 +$FRWPT,3002.77900,N,09135.93800,W,0.0,250502,190343*64 +$FRSPD,3.45*63 +$FRWPT,3002.80700,N,09135.95700,W,0.0,250502,190449*66 +$FRSPD,2.98*62 +$FRWPT,3002.82800,N,09135.98000,W,0.0,250502,190557*6F diff --git a/reference/waypoints.gpssim b/reference/waypoints.gpssim new file mode 100644 index 000000000..9d7800ab9 --- /dev/null +++ b/reference/waypoints.gpssim @@ -0,0 +1,9 @@ +$FRWPT,3558.32200,N,08708.08200,W,0.0*69 +$FRWPT,3605.44100,N,08640.77300,W,0.0*64 +$FRWPT,3559.77600,N,08637.20700,W,0.0*6F +$FRWPT,3602.30900,N,08638.91700,W,0.0*6B +$FRWPT,3606.73100,N,08644.50600,W,0.0*67 +$FRWPT,3603.84500,N,08647.43100,W,0.0*68 +$FRWPT,3605.26600,N,08648.58400,W,0.0*65 +$FRWPT,3603.45000,N,08653.52000,W,0.0*64 +$FRWPT,3604.96800,N,08652.03700,W,0.0*67 diff --git a/testo b/testo index 1f4601772..7020e0005 100755 --- a/testo +++ b/testo @@ -1063,4 +1063,13 @@ rm -f ${TMPDIR}/axim-* ${PNAME} -i axim_gpb -f ${REFERENCE}/track/axim-sample.gpb -o gpx -F ${TMPDIR}/axim-sample.gpx compare ${REFERENCE}/track/axim-sample.gpx ${TMPDIR}/axim-sample.gpx +# +# Franson GPSGate simulation +# +${PNAME} -i geo -f ${REFERENCE}/../geocaching.loc -o gpssim -F ${TMPDIR}/waypoints.gpssim +compare ${TMPDIR}/waypoints.gpssim ${REFERENCE} +${PNAME} -i gpx -f ${REFERENCE}/track/tracks.gpx -o gpssim -F ${TMPDIR}/tracks.gpssim +compare ${TMPDIR}/tracks.gpssim ${REFERENCE}/track + + exit 0 diff --git a/vecs.c b/vecs.c index 72a5fecac..02c4bb0ef 100644 --- a/vecs.c +++ b/vecs.c @@ -55,6 +55,7 @@ extern ff_vecs_t glogbook_vecs; extern ff_vecs_t google_vecs; extern ff_vecs_t gpilots_vecs; extern ff_vecs_t gpl_vecs; +extern ff_vecs_t gpssim_vecs; extern ff_vecs_t gpspilot_vecs; extern ff_vecs_t gpsutil_vecs; extern ff_vecs_t gpx_vecs; @@ -551,6 +552,12 @@ vecs_t vec_list[] = { "GPS TrackMaker", "gtm" }, + { + &gpssim_vecs, + "gpssim", + "Franson GPSGate Simulation", + "gpssim" + }, #if CSVFMTS_ENABLED { &garmin_txt_vecs, diff --git a/xmldoc/formats/gpssim.xml b/xmldoc/formats/gpssim.xml new file mode 100644 index 000000000..c318310ff --- /dev/null +++ b/xmldoc/formats/gpssim.xml @@ -0,0 +1,9 @@ + + This is a write-only format used to feed waypoints, tracks, and routes + into Franson Technolgies' + GpsGate simulator. + + + To use these files in GpsGate, select 'Simulator' and then + "File->Open". + diff --git a/xmldoc/formats/options/gpssim-split.xml b/xmldoc/formats/options/gpssim-split.xml new file mode 100644 index 000000000..2f20ce511 --- /dev/null +++ b/xmldoc/formats/options/gpssim-split.xml @@ -0,0 +1,17 @@ +When this options is specified, GPSBabel will split + split the output into multiple files using the output filename + as a base. For example, if you specify an output file of 'mytrip', + + mytrip-waypoints.gpssim - will contain the waypoints. + mytrip-track0000.gpssim - will contain the first track. + mytrip-track0001.gpssim - will contain the second track. + ... and so on. + mytrip-route0000.gpssim - will contain the first route. + mytrip-route0001.gpssim - will contain the seconds route. + ... and so on. + + + + +Valid values for this option are 0 (off) and 1 (on). The default is '0'. + diff --git a/xmldoc/formats/options/gpssim-wayptspd.xml b/xmldoc/formats/options/gpssim-wayptspd.xml new file mode 100644 index 000000000..0954b8c85 --- /dev/null +++ b/xmldoc/formats/options/gpssim-wayptspd.xml @@ -0,0 +1,3 @@ + + This options specifies the speed of the simulation in knots. + -- 2.30.2